//
// Created by maohuan on 2022/12/1.
//

#ifndef INC_1400PROXY_SQLITEHELPER_H
#define INC_1400PROXY_SQLITEHELPER_H

#include <mutex>
#include <map>
#include <vector>

typedef struct sqlite3 sqlite3_handle;

class SQLiteHelper
{
public:
    SQLiteHelper();
    virtual ~SQLiteHelper();
    bool execSQL(const char* sql);
    static SQLiteHelper& instance();

    int numRows(const char* sql);
    int rawQuery(const char* sql, std::map<std::string, std::string>* mapValue,int max_platform_num);
    int rawQuery(const char* sql, std::map<std::string, std::string>& mapValue);
    int rawQuery(const char* sql, std::vector<std::map<std::string, std::string> >& mapValue);
    bool openDB(const char* path);
    void closeDB();

private:
    sqlite3_handle*		m_db;
    std::mutex m_event_mutex;
};


#endif //INC_1400PROXY_SQLITEHELPER_H
